/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package eikotrade.javafx.controlls;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
 *
 * @author michel
 */
public class GoToButton extends EikoTradeButton{
    
    public GoToButton(String label, Scene sceneToGoto, Stage primaryStage) {
        super(label);
        setOnAction(buildEventHanlder(sceneToGoto, primaryStage));
    }
    
    private EventHandler buildEventHanlder(final Scene scene, final Stage stage){
        return new EventHandler<ActionEvent>() {

            public void handle(ActionEvent event) {
                stage.setScene(scene);
            }
        };
    }
    
}
